#ifndef __WORKER_THREAD_H__
#define __WORKER_THREAD_H__

#include <thread>
#include <functional>
#include <condition_variable>
#include <mutex>

class WorkerThread {
  public:
    explicit WorkerThread(std::function<void()> &&fun);
    ~WorkerThread();

    void Run();
    void Pause();
    void Resume();
    void Stop();

  private:
    std::function<void()> call_back = nullptr;
    std::thread work_thread;
    std::mutex pause_mutex;
    std::condition_variable pause_cv;
    bool paused = false;
    bool stoped = false;
};

#endif // __WORKER_THREAD_H__